<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="user/_fragment :: head(~{::title})">
    <title>博客管理后台</title>
</head>
<body class="hold-transition skin-blue sidebar-mini">

<!--头部导航-->
<nav th:replace="user/_fragment :: left-menu"></nav>
<!----------------------------------------------------------------------------------------->
<!-- 内容区域 -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            收藏分类
            <small>weblog</small>
        </h1>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">

                        <h3 class="box-title"></h3>
                        <button type="button" class="btn btn-default" style="color: grey" data-toggle="modal" data-target="#myModal">添加新的分类</button>
                        <label style="color: darkred;" th:text="${Msg}"></label>
                        <!--添加分类对话框-->
                        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                            <div class="modal-dialog">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <div class="modal-header">
                                            <h4 class="modal-title" id="myModalLabel">请填写要添加的收藏分类名称</h4>
                                        </div>
                                    </div>
                                    <form th:action="@{/catagory/addCollect}" method="post">
                                        <div class="modal-body">
                                            <div class="form-group">
                                                <label class="col-sm-2 control-label">分类名称</label>
                                                <div class="col-sm-10">
                                                    <input type="text" name="catagoryName" class="form-control">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="modal-footer" style="margin-top: 10%">
                                            <button type="reset" class="btn btn-default">重置</button>
                                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                            <button type="submit" class="btn btn-primary">添加</button>
                                        </div>
                                    </form><!-- /.modal-content -->
                                </div>
                            </div><!-- /.modal -->
                        </div>
                        <!-- / 添加分类对话框-->
                        <div class="box-tools">
                            <div class="input-group input-group-sm" style="width: 150px;">
                                <input type="text" name="table_search" class="form-control pull-right" placeholder="Search">

                                <div class="input-group-btn">
                                    <button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body table-responsive no-padding">
                        <table class="table table-hover">
                            <!--点击某一行，应该跳到文章详情页-->
                            <tr>
                                <th>ID</th>
                                <th>分类名称</th>
                                <!--<th>文章数量</th>-->
                                <th>是否隐藏</th>
                                <th></th>
                            </tr>
                            <tr th:each="c:${catagoryList}">
                                <td th:text="${c.catagoryId}"></td>
                                <td th:text="${c.catagoryName}"></td>
                                <!--<td th:text="${c.passageNum}"></td>-->
                                <td >
                                    <span class="label label-success" th:text="${c.isDisplay}==1?'隐藏':'公开'">Approved</span>
                                </td>
                                <td>
                                    <button type="button" class="btn btn-default btn-sm" style="color: grey">
                                        <a th:href="@{/passage/findByCollectCatagory/{id}(id=${c.catagoryId})}">查看详情文章</a>
                                    </button>
                                    <button type="button" class="btn btn-danger btn-sm">
                                        <a th:href="@{/catagory/delCollect/{id}(id=${c.catagoryId})}">×</a>
                                    </button>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
        </div>
    </section>
    <!-- /.content -->
</div>
<!-- 内容区域 /-->
<!----------------------------------------------------------------------------------------->
<!--底部footer-->
<footer th:replace="user/_fragment :: footer"></footer>
</body>

<th:block th:replace="user/_fragment :: script">
</th:block>

<script>
    // 设置激活菜单
    function setSidebarActive(tagUri) {
        var liObj = $("#" + tagUri);
        if (liObj.length > 0) {
            liObj.parent().parent().addClass("active");
            liObj.addClass("active");
        }
    }
    $(document).ready(function() {
        // 激活导航位置
        setSidebarActive("collect");
    });
</script>

</html>
